module("jquery.neocoin.test")
test("test for test", function(){
	reset();
	expect(3);
	ok(true);
	equals('a', 'a');
	same(['a', 'b'], ['a', 'b']);
})

test("switchClass", function(){
	var jo = jQuery("#switchClass");
	var div1 = jo.find("#div1");
	
	div1.switchClass("classA", true);
	ok(div1.hasClass("classA"), "Apply class");
	
	div1.switchClass("classA", false);
	ok(div1.hasClass("classA") == false, "remove Class");
	
	ok(jo.find("#div2").hasClass("classA"), "Verify class");
	ok(jo.find("#div2").switchClass("classA", false).hasClass("classA") == false);
});

test("switchShow", function(){
	reset();
	var div1 = jQuery("#switchShow > #div1");
	ok(div1.is(":visible"));
	
	ok(div1.switchShow(false).is(":visible") == false);
	ok(div1.switchShow(true).is(":visible"));
});

test("sortChildren", function(){
	reset();
	var jo = jQuery("#sortChildren");
	
	equals(jo.find("ul:first > li > label:first").text(), "b");
	jo.find("ul").sortChildren(function(l, r){
		var lv = jQuery(l).find('label').text();
		var rv = jQuery(r).find('label').text();
		return lv > rv;
	});
	
	equals(jo.find("ul:first > li > label:first").text(), "a");
	equals(jo.find("ul:first > li > label").text(), "abcd");
	var e = jo.find("ul:first > li > label").map(function(){
		return jQuery(this).text();
	});
	same(e.get(), ['a', 'b', 'c', 'd']);
	equals(jo.find("ul:nth-child(2) > li > label").text(), "aabbccdd");
});


test("parseFragment", function(){
	reset();
	
	var hash = $.fragment.parse("key1=value1&key2=value2");
	equals(hash["key1"],'value1');
	equals(hash["key2"],'value2');

	equals("key1=value1&key2=value2", $.fragment.make(hash));
});


